package prototype;

import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;

public class koneksi {

//    String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
//    String userid = "MHS105314113";
//    String password = "MHS105314113";
    String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
    String userid = "shinryu";
    String password = "shinryu";
    Connection conn;
    Statement stmt;
    ResultSet rset;
    String query;
    String sqlString;

    public koneksi() {
    }

    public Connection DBConn() {
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            System.out.println("Koneksi berhasil");

        } catch (SQLException ex) {
            System.out.println("Masih belum koneksi");
        }
        return conn;
    }

    public void close() {
        try {
            conn.close();
        } catch (SQLException ex) {
            System.out.println("Tidak bisa tutup koneksi");
        }
    }

    public static void main(String[] args) {
        koneksi k = new koneksi();
        k.DBConn();
    }
}
